<%@page import="com.vakitdaraliyor.www.dao.CountdownDao"%>
<%@page import="java.util.*"%>
<%@page import="com.vakitdaraliyor.www.entity.Countdown"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<html>
<head>
<meta charset="utf-8">
<title>Yönetici Paneli</title>

<!-- JQuery -->
	<script type="text/javascript" src="resources/js/jquery.min.js"></script>
	<!-- Countdown Javascript -->
	<script type="text/javascript" src="resources/js/jquery.countdown.js"></script>
	<!-- Bootstrap core CSS -->
	<link href="resources/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<!-- Fontawesome CSS -->
	<link href="resources/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	<!-- Countdown CSS -->
	<link rel="stylesheet" type="text/css" href="resources/css/style.css" media="screen">
	<!-- Bootstrap core JavaScript -->
	<script src="resources/js/bootstrap.min.js" type="text/javascript"></script>
<script type="text/javascript">
	$(function() {
		$('.countdown.simple').countdown({
			onEnd : function() {
				$(this.el).addClass('ended');
			}
		});
	});
</script>
</head>
<body>
	<div class="container">
		<div class="row Header">
			<div class="col-sm-12">
				<jsp:include page="../Menu.jsp" />
			</div>
		</div>
		<div class="jumbotron">
		<h1>Yönetici Paneli</h1>
		<hr class="divider">
		</div>
		
		<div class="row">
			<div class="col-sm-12">
				<table class="table table-bordered table-striped">
				<thead>
				<tr class="success">
				<th>Gerisayım Adı</th>
				<th>Kalan Zaman</th>
				<th class="text-center">Sil</th>
				<th class="text-center">Düzenle</th>
				</tr>
				</thead>
				<tbody>
					<c:forEach var="gerisayim" items="${tarihListesi }">
						<c:set var="tarih">${gerisayim.gerisayimTarihi}</c:set>
						<c:set var="saat">${gerisayim.gerisayimSaati}</c:set>
						<c:set var="tarihDizi" value="${fn:split(tarih, '-')}" />
						<c:set var="saatDizi" value="${fn:split(saat, ':')}" />
						<tr>
							<td style="vertical-align: middle;">${gerisayim.gerisayimAdi}</td>
							<td style="vertical-align: middle;">
								<div class="countdown simple" data-date="${tarihDizi[1]} ${tarihDizi[2]}, ${tarihDizi[0]} ${saatDizi[0]}:${saatDizi[1]}:00"
									 style="background:transparent; color: black;"></div>
							</td>
							<td class="text-center" style="vertical-align: middle;">
								<form method="post" action="Sil" role="form" style="margin: 0px;">
									<input hidden="true" name="gerisayimAdi"value="${gerisayim.gerisayimAdi}">
								   	<input hidden="true" name="gerisayimTarihi" value="${gerisayim.gerisayimTarihi}">
									<input hidden="true" name="gerisayimId" value="${gerisayim.id}">
									<input hidden="true" name="gerisayimSaati" value="${gerisayim.gerisayimSaati}">
									<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-remove"></span>&nbsp;Sil</button>
								</form>
							</td>
							<td class="text-center" style="vertical-align: middle;">
								<form  method="post" action="admin/Duzenleme.jsp" role="form" style="margin: 0px;">
									<input hidden="true" name="gerisayimAdi"value="${gerisayim.gerisayimAdi}">
								   	<input hidden="true" name="gerisayimTarihi" value="${gerisayim.gerisayimTarihi}">
									<input hidden="true" name="gerisayimId" value="${gerisayim.id}">
									<input hidden="true" name="gerisayimSaati" value="${gerisayim.gerisayimSaati}">
									<button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-edit "></span>&nbsp;Düzenle</button>
								</form>
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<a class="btn btn-success" href="GetCategories">Ekle</a>	
	<a class="btn btn-success" href="admin/AddCategory.jsp">Kategori Ekle</a>
	<a class="btn btn-success" href="#">Yönetici Ekle</a>
	
</div>
	
</body>
</html>